<?php
//php支持多行字符串
$s='I\'m a styudent\\teacher.';
echo $s,"\n";
$s="He say:\"I'm student.\"";
echo $s,"\n";

$a='计算机123';
printf("[%d] [%5d] [%05d] [%x] [%5x] [%05x]\n",26,26,26,26,26,26);
echo strlen($a),"\n";
echo ord('0'),"\n";
echo ord('0123'),"\n";
echo substr($a,3),"\n";
echo substr($a,6,4),"\n";

for($i=0,$l=strlen($a);$i<$l;++$i){
    printf("%02x",ord(substr($s,$i)));
}
echo "\n";
echo ord(substr($a,0)),"\n";
$b="\xE8\xAE\xA1\u{7B97}\u{673A}";
echo $b,"\n";




$s=<<<'XXXXYYYY'
        <?PHP
        php支持多行字符串
        $s='I\'m a student\\teacher.';//仅支持两个转义字符 （1）\'表示',  (2)\\表示\
        echo $s,"\n";
        $s="He say:\"I'm a student.\"";//支持更多的转义字符
        echo $s,"\n";
        XXXXYYYY;
echo $s,"\n";

//仅仅双引号字符串，heredoc支持变量解析
//(1)变量  (2)数组元素
$go='去';
$good='好的';
echo "go的意思是：$go\n";//go的意思是:去
echo "good的意思是：$good\n";//good的意思是：好的
echo "good的意思是：{$go}od\n";//good的意思是：去od
echo "good是：“{$good}”的意思是\n";//good是：“好的”的意思

$a=[90,'php'=>98,'age'=>18];//数组元素的解析
echo "a[0]=$a[0]\n";
echo "a['php']=$a[php]\n";//php不要加引号
echo "a['age']={$a['age']}\n";//age加引号，元素必须包在{}中

//
$s='string';
$s[0]='s';
echo $s,"\n";
$s[3]='osc';
echo $s,"\n";
$s[8]='!';
echo $s,"\n";

echo $s,"\n";